package core.genetic.mutation;

import utility.*;
import core.*;
import core.genetic.*;

public class ExpoGenesMutation implements HromozomMutation {

	public final double mutRatePop;
	public final double countMut;
	
	public ExpoGenesMutation(double mutRagePop, double countMut) {
		this.mutRatePop = mutRagePop;
		this.countMut = countMut;
	}
	
	
	@Override
	public void mutate(Individual ind) {
		if (Utils.random.nextDouble() > mutRatePop)
			return;

		int len = ind.getLength();
		int count = (int)(Math.abs(Utils.random.nextGaussian()*countMut)+1);
		for (int i = 0; i < count; i++)	
			ind.setGene(i,Mode.mode.singleMutation.getMutated(ind.getGene(Utils.random.nextInt(len))));
	}

	
	
}
